<template>
  <div class="operational-records">
    <el-card>
      <el-table
        v-loading="isLoading"
        :data="tableData"
        border
        style="width: 100%"
      >
        <el-table-column
          fixed
          width="100"
          prop="user_id"
          label="操作人员ID"
          align="center"
        />
        <el-table-column
          label="操作类型"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.operate_type | getMissionStatus }}
          </template>
        </el-table-column>
        <el-table-column
          prop="operate_explain"
          label="操作内容"
          align="center"
        />
        <el-table-column
          prop="operate_time"
          label="操作时间"
          align="center"
        />
      </el-table>

      <el-pagination
        :page-size="10"
        layout="total, prev, pager, next, jumper"
        :total="total"
        @current-change="handleCurrentChange"
      />
    </el-card>
  </div>
</template>
<script>
import { operateLogSearch } from '@/api/user'
export default {
  filters: {
    getMissionStatus(status) {
      let StringType = ''
      switch (status) {
        case 'CAROUSEL_SAVE' :
          StringType = '创建轮播图'
          break
        case 'CAROUSEL_UPDATE' :
          StringType = '更新轮播图'
          break
        case 'CAROUSEL_DELETE' :
          StringType = '删除轮播图'
          break
        case 'CONFIG_UPDATE' :
          StringType = '更新系统配置'
          break
        case 'MEMBER_PACKAGE_SAVE' :
          StringType = '创建会员套餐'
          break
        case 'MEMBER_PACKAGE_UPDATE' :
          StringType = '更新会员套餐'
          break
        case 'MEMBER_PACKAGE_DELETE' :
          StringType = '删除会员套餐'
          break
        case 'NORMAL_ADMIN_SAVE' :
          StringType = '创建普通管理员'
          break
        case 'NORMAL_ADMIN_UPDATE' :
          StringType = '更新普通管理员'
          break
        case 'SELLER_UPDATE' :
          StringType = '更新商家'
          break
        case 'BUYER_UPDATE' :
          StringType = '更新买手'
          break
        case 'TRANSFER_EXAMINE' :
          StringType = '审核转账'
          break
        case 'SELLER_SHOP_EXAMINE' :
          StringType = '审核商家店铺'
          break
        case 'BUYER_TAOBAO_EXAMINE' :
          StringType = '审核买手淘宝账号'
          break
        case 'BUYER_CREDENTIALS_EXAMINE' :
          StringType = '审核买手证件'
          break
        case 'BUYER_BANK_CARD_EXAMINE' :
          StringType = '审核买手银行卡'
          break
        case 'BUYER_WITHDRAW_EXAMINE' :
          StringType = '审核买手提现'
          break
        case 'SELLER_WITHDRAW_EXAMINE' :
          StringType = '审核商家提现'
          break
        case 'BUYER_MISSION_EXAMINE' :
          StringType = '审核买手任务'
          break
        case 'SYSTEM_TRANSFER' :
          StringType = '系统转账'
          break
        case 'SELLER_MISSION_DELETE' :
          StringType = '删除商家任务'
          break
        case 'BUYER_MISSION_DELETE' :
          StringType = '删除买手任务'
          break
        case 'SELLER_BANK_CARD_EXAMINE' :
          StringType = '商家银行卡审核'
          break
        default:
          StringType = '未知类型'
          break
      }
      return StringType
    }
  },
  data() {
    return {
      ruleForm: {},
      tableData: [],
      isLoading: false,
      total: 0,
      params: {
        pageNumber: 1
      }
    }
  },
  mounted() {
    this.operateLogSearch()
  },
  methods: {
    operateLogSearch() {
      this.isLoading = true
      operateLogSearch(this.params).then(res => {
        this.tableData = res.list
        this.total = res.totalRow
        this.isLoading = false
      }).catch(() => {
        this.isLoading = false
      })
    },
    onSubmit() {
      this.ruleForm.pageNumber = 1
      this.operateLogSearch()
    },
    handleClick(row) {

    },
    handleCurrentChange(page) {
      this.params.pageNumber = page
      this.operateLogSearch()
    }
  }
}
</script>
<style lang="scss">
  .operational-records{
    .el-card{
      .ruleForm{
        .el-input{
          width: 200px;
        }
        .el-select{
          width: 200px;
        }
      }
    }
  }
</style>
